#override("title")
CiaoTalking - 管理系统
#end
#override("css")
<link href="#springUrl('/static/css/plugins/bootstrap-table/bootstrap-table.min.css')" rel="stylesheet">
#end
#override("breadcrumb")
<li><a>运营管理</a></li><li class="active"><strong>点评列表</strong></li>
#end
#override("content")
<div class="row">
	<div class="ibox-content text-right form-inline" style="background: #F3F3F4;">
		<div class="input-group">
            <span class="input-group-btn">
				<!--<select class="form-control m-b" name="sortSelect" id="sortSelect" onchange="changeType()" >
                    <option  selected="selected" value="''">排序</option>
                    <option value="createDate" >点评时间</option>
                </select>-->
			</span>
			<input type="text" class="form-control" id="searchKey">
			<span class="input-group-btn">
				<button type="button" class="btn btn-info" onclick="searchShopItemEvaluate()" >搜索</button>
			</span>
		</div>
		<!--<button class="btn btn-primary" onclick="editItem(null)" type="button">
		<i class="fa fa-pencil"></i>&nbsp;添加商品</button>-->
	</div>
</div>
<div class="row">
    <div class="col-sm-12">
        <table id="dataTable"></table>
    </div>
</div>
#end
#override("js")
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/bootstrap-table-mobile.min.js')"></script>
<script src="#springUrl('/static/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js')"></script>
<script src="#springUrl('/static/plugins/layer-v2.2/layer/layer.js')"></script>
<script src="#springUrl('/static/js/base_list.js')"></script>
<script src="#springUrl('/static/js/common.js')"></script>
<script type="text/javascript">

    var dataUrl = "#springUrl('/operate/evaluate/getShopItemEvaluateList')";
    var dataColumns = [{
        field: 'id',
        title: '序号'
    }, {
        field: 'shopItem.itemName',
        title: '商品'
    },  {
        field: 'itemId',
        title: '商品ID',
        visible:false
    },{
        field: 'grade',
        title: '评分'
    }, {
        field: 'shopUser.nickname',
        title: '点评用户'
    },{
        field: 'userId',
        title: '点评用户ID',
        visible:false
    }, {
        field: 'createDate',
        title: '点评时间'
    },{
        title: '操作',
        formatter: function (value, row, index) {
            var id = row.id;
            return '<a class="btn btn-xs btn-warning" onclick="showEvaluateDetail(' + "'" + id + "'" + ')"><i class="fa fa-pencil"></i>点评详情</a> '+
                    '<a class="btn btn-xs btn-warning" onclick="delEvaluateItem(' + "'" + id + "'" + ')"><i class="fa fa-pencil"></i>删除</a> ';
        }
    }
    ];


    $(function(){
        $("#dataTable").bootstrapTable("hideColumn","userId,itemId");
    });

    function showEvaluateDetail(evaluateId){
        var title = "点评详情";
        var url;
        if(evaluateId!=null){
            url = "#springUrl('/operate/evaluate/evaluatedetail')?evaluateId=" + evaluateId;
        }
        layer.open({
            type: 2,
            title: title,
            shadeClose: true,
            shade: 0.8,
            area: ['850px', '540px'],
            fix: false,
            maxmin: true,
            content: url
        });
    }

    function showPoint(num){
        var result =0;
            result = num/100;
            return result+".00";
    }

    /*function changeType(){
        var val  = $("#sortSelect").val();
        var url = "#springUrl('/order/getShopOrderList')"+"?sortField="+val;
        $("#dataTable").bootstrapTable("refresh",{url:url});
    }*/

    function delEvaluateItem(evaluateId){
        if(evaluateId!=null){
            layer.confirm('确定删除吗？',{btn:['确定','取消']},
                    function(){
                        $.ajax({
                            type:"POST",
                            url:"#springUrl('/operate/evaluate/delEvaluateItem')?id="+evaluateId,
                            dataType:"text",
                            success:function(data){
                                if(data=='true'){
                                    $("#dataTable").bootstrapTable('refresh',{url:dataUrl});
                                }
                                layer.closeAll();
                            }
                        });
                    },
                    function(){
                        return;
                    }
            );
        }
    }

    function searchShopItemEvaluate(){
        var val = $.trim( $("#searchKey").val());
        var str = val.split(" ").join("");
        var url = "#springUrl('/operate/evaluate/getShopItemEvaluateList')"+"?searchKey="+str;
        $("#dataTable").bootstrapTable("refresh",{url:url});
}

</script>
#end
#extends("/common/framework.html")
